<?php
namespace app\common\validate;

use think\Validate;

class TaskValidate extends Validate
{
    protected $rule =   [
        'id'                   => 'require|integer',
        'user_id|用户ID'       => 'require|integer',
        'task_id|任务ID'       => 'require|integer',
        'project_id|项目ID'    => 'require|integer',
        'to_user_id|接收人'    => 'require|integer',
        'page|页数'            => 'require|integer',
        'limit|条数'           => 'require|integer',
        'title|标题'           => 'require|length:1,100',
        'content|任务内容'     => 'require',
        'finish_time|完成时间' => 'require|date',
        'status|状态'          => 'require|in:1,2,3,4',
        'score|分数'           => 'require|integer',
        'remark|任务评语'      => 'require|length:1,100',
    ];
    
    protected $scene = [
        /** 接口 */
        'add'    => ['user_id', 'project_id', 'to_user_id', 'title', 'content', 'finish_time'],
        'edit'   => ['user_id', 'project_id', 'to_user_id', 'title', 'content', 'finish_time', 'task_id'],
        'list'   => ['user_id', 'page', 'limit', 'status'],
        'finish' => ['to_user_id', 'task_id'],
        'eval'   => ['to_user_id', 'task_id', 'score', 'remark'],
    ];
}